<template>
  <div>
    <BreadCrumbShow />
    <div class="content">

      <el-row :gutter="20">
        <el-col :span="4">
          <el-card>
            <el-menu :default-active="activeRouter" class="el-menu-vertical">
              <el-menu-item
                v-for="(router, index) in showMenu"
                :index="router.path"
                :key="index"
                @click="menuClick(router)"
              >
                <span slot="title">{{ router.meta.title }}</span>
              </el-menu-item>
            </el-menu>
          </el-card>
        </el-col>
        <el-col :span="20">
          <div class="member-content-box">
            <router-view></router-view>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      pageTitle: "用户中心",
      activeRouter: "/user/index",
      memberRouterList: [
        {
          meta: {
            title: "修改资料",
            icon: "",
            authCode: 1010100
          },
          path: "/user/profile",
        },{
          meta: {
            title: "授权账号",
            icon: "",
             authCode: 1010200
          },
          path: "/user/empower",
        },
        {
          meta: {
            title: "我的账单",
            icon: "",
            authCode: 1010300
          },
          path: "/user/bill",
        },
        {
          meta: {
            title: "地址管理",
            icon: "",
            authCode: 1010500
          },
          path: "/user/address",
        },
        {
          meta: {
            title: "进库管理",
            icon: "",
            authCode: 1010700
          },
          path: "/user/entry",
        },
        {
          meta: {
            title: "标签更换",
            icon: "",
            authCode: 1010800
          },
          path: "/user/rfid",
        },
        {
          meta: {
            title: "修改密码",
            icon: "",
            authCode: 1010600
          },
          path: "/user/password",
        },
        // {
        //   meta: {
        //     title: "待入库列表",
        //     icon: "",
        //     authCode: 1010900
        //   },
        //   path: "/user/warehousing",
        // },
      ],
      showMenu: []
    };
  },
  components: {},
  mounted() {
    this.activeRouter = this.$route.fullPath;
    JSON.parse(localStorage.getItem("localUserInfo")) &&
      this.commonFun.getAuthRoute(
        this.memberRouterList,
        JSON.parse(localStorage.getItem("localUserInfo")).authIdArr || [],
        this.showMenu
      );
  },
  watch: {
    $route(to, from) {
      this.activeRouter = this.$route.fullPath;
    },
  },
  methods: {
    menuClick(e) {
      this.$router.push({
        path: e.path,
      });
    },
    handleClick(e) {
      this.$router.push({
        path: e.name,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  margin: 28px 8px 10px 8px;
  min-height: 650px;
}
.member-content-box {
  padding:10px 20px;
}
</style>
